begintownscript;

 begintownscript;	

 variables;
int i,j,k,r1,choice;
body;
beginstate INIT_STATE;

	if ((get_flag(7,7) == 0) && (get_flag(110,3) == 1)) {
		set_flag(7,7,5);
		set_town_visibility(7,0);
		set_town_visibility(0,0);
		set_town_visibility(8,1);
}

	set_name(21,"Ogre male");
	set_name(22,"Ogre female");

	if (get_flag(4,3) == 0) {
		force_instant_terrain_redraw();
		message_dialog("You enter the ogre village. It seems that most of the ogres have vacated their home, which is not the largest of settlements. Maybe it could hold a hundred ogres if they were packed very tight. But as it is, there is practically no movement to be seen.","Only a small group of ogres is waiting for you on the north side of the village.");
		set_flag(4,3,1);
}

	add_char_to_group(6,1);
	add_char_to_group(8,1);
	add_char_to_group(24,1);
	add_char_to_group(25,1);

	if ((get_flag(6,5) == 1) && (get_flag(4,9) == 0) && (get_flag(152,7) != 1)) {
		activate_hidden_group(1);
		set_flag(4,9,1);
}
	if ((get_flag(6,5) == 5) && (get_flag(4,9) == 0) && (get_flag(152,7) != 1)) {
		activate_hidden_group(1);
		set_flag(4,9,1);
}
	 break;	

beginstate START_STATE;
break;	

beginstate EXIT_STATE;
break;

beginstate 10;
	reset_dialog();
	add_dialog_str(0,"This passage leads to a dark cave. It is well-travelled with many footprints going back and forth. However, a lion's share of the most recent foot prints seems to be going in and not out. This must be where the rest of the ogres are hiding.",0);
	add_dialog_str(1,"Do you want to enter the caves now?",0);
	add_dialog_choice(0,"No, not yet.");
	add_dialog_choice(1,"Yes. Onwards!");
	choice = run_dialog(1);

	if (choice == 1)
		block_entry(1);

	if (choice == 2)
		move_to_new_town(5,44,8);
 break;

beginstate 11;
	if (get_flag(4,1) == 0) {
		message_dialog("Huge hairy heads turn in your direction. They are worgs. There are not that many of them, but it does not matter. You have stepped into their territory. You are not part of the pack. You are an intruder.","They bare their white fangs and pounce to tear out your throat.",);
		set_flag(4,1,1);
}
 break;

beginstate 12;
	if (get_flag(4,2) == 0) {
		message_dialog("You see a narrow ditch circling around some kind of defensive area. There are ogres hiding behind the ditch and it looks like they are preparing to repel you. There are not that many of them, but they seem determined.","There is a cave entrance behind the ditch in the west side of the mountains. It must be what the ogres are trying to defend. But what is in the cave?",);
		alert_char(6);
		set_flag(4,2,1);
}
 break;

beginstate 13;
	if (get_flag(4,4) == 0) {
		reset_dialog();
		add_dialog_str(0,"The door opens just enough for you to see inside. Ogres are cowering in the corner of a squalid little room. One of them snarls like an animal. You notice that its voice is not a low as an ogre voice generally is.",0);
		add_dialog_str(1,"Simply due to this observation, you take a deeper look at the ogre in question. You realize it is female and it has wrapped its one hand around the other ogre who is male and looks about the same age as the female.",0);	
		add_dialog_str(2,"The female snarls at you again and shouts. _Humun! Shoo! Our stuff! Our home! You no welcome!_",0);
		add_dialog_choice(0,"Sorry, I'll leave now.");
		add_dialog_choice(1,"Hah! Die monster!");
		choice = run_dialog(1);

		if (choice == 1) {
			flip_terrain(11,9);
			block_entry(1);
			play_sound(59);
}

		if (choice == 2) {
			message_dialog("The ogres grab a hold of something with which they can defend themselves and rise up to meet your attack.","");
			set_flag(4,4,1);
			set_attitude(21,10);
			set_attitude(22,10);
		}
}
 break;

beginstate 14;
	if (get_flag(4,6) == 0) {
		message_dialog("This building is dead quiet. There is no-one on the hallways, but that does not remove the stench. The odor of perspiration and urine hangs heavily on the air. It is not like ogres are known for their cleanliness.","It is possible that the ogres booby-trapped the building in hopes of killing you, or at the very least to discourage you from entering. At any rate the ogres failed and the traps would suggest there is something valuable inside.");
		set_flag(4,6,1);
}
 break;

beginstate 15;
	if (get_height(char_loc_x(0),char_loc_y(0)) == 4) {
		teleport_party(10,27,1);
		print_str("You climb out of the ditch.");
}
 break;

beginstate 16;
	if (get_height(char_loc_x(0),char_loc_y(0)) == 4) {
		teleport_party(27,29,1);
		print_str("You climb out of the ditch.");
}
 break;

beginstate 17;
	block_entry(1);
	message_dialog("You may not jump here. Ever. Never-ever. Nope. Can't be done.","");
 break;
